<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link th:href="@{/ajax/libs/iCheck/custom.css}" rel="stylesheet"/>
<link href="/ajax/libs/jquery-layout/jquery.layout-latest.css" th:href="@{/ajax/libs/jquery-layout/jquery.layout-latest.css}" rel="stylesheet"/>
<link href="/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css" th:href="@{/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css}" rel="stylesheet"/>
<body class="gray-bg">
<div class="container-div ui-layout-center">
    <div class="row">
        <div class="col-sm-12 select-info">
            <form id="operlog-form">
                <div class="select-list gd">
                    <ul>
                        <li>收货地址:<input type="text" name="id"/></li>
                        <li>属于哪个用户的地址:<input type="text" name="ownName"/></li>
                        <li>收货人:<input type="text" name="consignee"/></li>
                        <li>收货电话:<input type="text" name="phone"/></li>
                        <li>收货地址:<input type="text" name="addressDetail"/></li>
                        <li>是否默认，0，不是，默认是1:<input type="text" name="isDefault"/></li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search($('form').attr('id'))"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset($('form').attr('id'))"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group hidden-xs" id="toolbar" role="group">
            <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" shiro:hasPermission="tbAddress:add"><i class="fa fa-plus"></i> 新增</a>
            <a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.batRemove()" shiro:hasPermission="tbAddress:del"><i class="fa fa-trash-o"></i> 删除</a>
        </div>
        <!-- 数据加载 -->
        <div class="col-sm-12 select-info order-table">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
        </div>
    </div>
</div>

<div th:include="include :: footer"></div>
<script th:src="@{/ajax/libs/jquery-layout/jquery.layout-latest.js}"></script>
<script th:src="@{/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>
<script th:inline="javascript">

    var prefix = "/tbAddress"; //url前缀
    var updatedFlag = [[${@permission.hasPermi('tbAddress:edit')}]];//修改按钮 + 权限
    var delFlag = [[${@permission.hasPermi('tbAddress:del')}]];//删除按钮 + 权限
    window.onload = function () {
        queryUserList();
    };
    //bookstrap = bookstrap-table + jquery
    function queryUserList() {
        var options = {
            url: prefix+"/tableList",//列表页面url
            createUrl: prefix+"/toAdd",//新增页面url
            updateUrl: prefix+"/edit/{id}",//修改页面url
            removeUrl: prefix+"/del",//删除url
            sortName: "id",//排序字段 -- 数据库
            sortOrder: "desc",//排序方式
            modalName: "", //当前列表名称
            search: false,//
            showExport: true,//导出exl
            columns: [{checkbox: true},//列表字段 start
            {field: 'id', title: '收货地址'},
            {field: 'ownName', title: '属于哪个用户的地址'},
            {field: 'consignee', title: '收货人'},
            {field: 'phone', title: '收货电话'},
            {field: 'addressDetail', title: '收货地址'},
            {field: 'isDefault', title: '是否默认，0，不是，默认是1'},
            {
                title: '操作',
                align: 'center',
                formatter: function (value, row, index) {//按钮
                    var actions = [];
                    actions.push('<a class="' + updatedFlag + 'btn btn-success btn-xs"   href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit">编辑</i></a> ');
                    actions.push('<a class="' + delFlag + 'btn btn-danger  btn-xs " href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove">删除</i></a> ');
                    return actions.join('');
                }
            }]//列表字段 end
        };
        $.table.init(options);
    }
</script>
</body>
</html>